package oop第二章作业;

import java.util.Scanner;

public class Person {
    private  String  name;
    private   int  age;
    public String getName(){

        return name;

    }
    /*
    无参构造方法
     */
    public  void getName(String name){

        this.name=name;
        System.out.println(
                name
        );
    }
    public int  getage(){

        return age;
    }
    /*
    无参构造方法
     */
    public  void getage(int age){

        this. age=age;
        System.out.println(age);
    }
    public  Person (){
        name ="刘家康傻逼";
        age=1000;

    }
    public Person ( String name,int age){
        this.name=name;
        this.age=age;
    }
    /*
    有参构造方法
     */
    private   void display(){
        System.out.println(this.name+"今年"+this.age+"岁");
    }
    /*
    display 用this来调用属性值答应
     */
    public static void main(String[] args) {
        Person person =new Person();
        person.getName("张开心");
        person.getage(12);
        person.display();
    }
}
